import React, { useState, useCallback } from 'react';
/**
 * 基础hook
 *  useState
 *  useEffect
 *  useContext
 * 额外的hook
 *  useReducer
 *  useCallback
 *  useMemo
 *  useRef
 *  useImperativeHandle
 *  useLayoutEffect
 */

// 自定义hook，提供公共的逻辑和操作
const usePartState = function usePartState(initial) {
    let [state, setState] = useState(initial);
    const setPartState = (partState) => {
        setState({
            ...state,
            ...partState
        })
    }
    return [
        state,
        setPartState
    ]
}